<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>操作记录</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.3.5/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/jquery-easyui-1.3.5/themes/icon.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.5/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">

function searchSysOperationRecord(){
	var startTime=$("#i1").datebox("getValue");
	var endTime=$("#i2").datebox("getValue");
	var startTimeLong = new Date(startTime.replace(new RegExp("-","gm"),"/")).getTime();
	var endTimeLong = new Date(endTime.replace(new RegExp("-","gm"),"/")).getTime();
	 if(startTimeLong-endTimeLong>0){
		 $.messager.alert("系统提示","查询开始时间"+startTime+"不能大于结束时间"+endTime+"！");
		 return;
	 }
	 $("#dg").datagrid('load',{
	 	"startTime":startTimeLong,
	 	"endTime":endTimeLong
	 });
}
	
	function formatDatebox(value) {
		var datetimeType = "";
	    var date =new Date(value);
	    datetimeType = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()
	    +" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds()+" "+date.getMilliseconds();
	    return datetimeType;
	}
	
	function formatJsonObject(value) {
		if(value==null||value==""){
			return "";
		}else{
			return JSON.stringify(value);
		}
	}
	
	function formatIsSuccessful(val,row,index) {
		if(val==1){
			return '成功'; 
		}else if(val==0){
			return '<font color=red>失败</font>'; 
		}
		
	}
	
	function formatIsImplemented(val,row,index) {
		if(val==1){
			return '成功'; 
		}else if(val==0){
			return '<font color=red>失败</font>'; 
		}
		
	}
	
	function formatOperationType(value) {
		if(value==1){
			return "配置前置机TCH业务发送开关";
		}else if(value==2){
			return "配置前置机信令发送开关";
		}else if(value==3){
			return "配置前置机频谱发送开关";
		}else if(value==4){
			return "配置前置机频谱发送间隔";
		}else if(value==5){
			return "配置前置机监测频点";
		}else if(value==6){
			return "配置前置机IP地址";
		}else if(value==7){
			return "获取前置机工作状态";
		}else if(value==8){
			return "读取前置机重启事件时刻表";
		}else if(value==9){
			return "清除前置机故障记录和重启事件记录";
		}else if(value==10){
			return "获取前置机CPU、内存、硬盘使用率状态";
		}else if(value==11){
			return "获取前置机GPRS发送开关";
		}else if(value==12){
			return "设置频谱底噪";
		} else if (value==13) {
			return "设置服务器告警门限";
		} else if (value==14) {
			return "设置前置机告警门限";
		} else if (value == 15 || value == 16 || value == 17) {
			return "干扰分析设置";
		} else {
			return value;
		}
	}
	
	function formatOperationDetails(val, row, index) {
		var operationDetails = row.newValue;
		if(row.operationType==1){
			return "前置机号:"+operationDetails.frontProcessorId+
					" , TCH业务发送开关:"+operationDetails.tchSendSwitch+
					" , 上报目的IP地址:"+operationDetails.reportedIpAddress;
		}else if(row.operationType==2){
			return "前置机号:"+operationDetails.frontProcessorId+
					" , 信令发送开关:"+operationDetails.signalSendSwitch+
					" , 上报目的IP地址:"+operationDetails.reportedIpAddress;
		}else if(row.operationType==3){
			return "前置机号:"+operationDetails.frontProcessorId+
					" , 频谱发送开关:"+operationDetails.spectrumSendSwitch+
					" , 上报目的IP地址:"+operationDetails.reportedIpAddress;
		}else if(row.operationType==4){
			return "前置机号:"+operationDetails.frontProcessorId+
					" , 频谱发送间隔:"+operationDetails.reportInterva;
		}else if(row.operationType==5){
			return "前置机号:"+operationDetails.frontProcessorId+
					" , 监测频点:"+operationDetails.monitoringFrequency;
		}else if(row.operationType==6){
			return "前置机号:"+operationDetails.frontProcessorId+
					" , IP地址:"+operationDetails.ipAddress;
		}else if(row.operationType==7){
			return "前置机号:"+operationDetails.frontProcessorId;
		}else if(row.operationType==8){
			return "前置机号:"+operationDetails.frontProcessorId;
		}else if(row.operationType==9){
			return "前置机号:"+operationDetails.frontProcessorId;
		}else if(row.operationType==10){
			return "前置机号:"+operationDetails.frontProcessorId;
		}else if(row.operationType==11){
			return "前置机号:"+operationDetails.frontProcessorId+
			" , GPRS发送开关:"+operationDetails.gprsSendSwitch+
			" , 上报目的IP地址:"+operationDetails.reportedIpAddress;
		}else if(row.operationType==11){
			return "前置机号:"+operationDetails.frontProcessorId+
			" , 频谱底噪值:"+operationDetails.bottomNoiseThreshold;
		}else if(row.operationType==17){
			return "修改干扰告警参数";
		}else if(row.operationType==15){
			return "修改干扰分析参数";
		}else if(row.operationType==16){
			return "修改手动互调干扰";
		}else{
			return formatJsonObject(row.operationDetails);
		}
	}
</script>
</head>
<body style="margin: 1px">
<table id="dg" title="操作记录" class="easyui-datagrid"
   fitColumns="false" pagination="true" rownumbers="true" pageSize="100" pageList="[100,200,300,400,500]"
   url="${pageContext.request.contextPath}/sysOperationRecord/list.do" fit="true" toolbar="#tb">
   <thead>
   	<tr>
   		<th field="cb" checkbox="true" align="center"></th>
   		<th field="sysOperationRecordId" width="80" align="center">ID号</th>
   		<th field="operateTime" width="180" align="center" formatter="formatDatebox">操作时间</th>
   		<!-- <th field="userId" width="100" align="center">操作人编号</th>  -->
   		<th field="operationType" width="300" align="center" formatter="formatOperationType">操作类型</th>
   		<th field="oldValue" width="200" align="center" formatter="formatJsonObject">修改前的值</th>
   		<th field="newValue" width="200" align="center" formatter="formatJsonObject">修改后的值</th>
   		<th field="operationDetails" width="200" align="center" formatter="formatOperationDetails">操作详情</th>
   		<th field="isImplemented" width="80" align="center" formatter="formatIsImplemented">是否已执行</th>
   		<th field="isSuccessful" width="80" align="center" formatter="formatIsSuccessful">是否成功</th>
   	</tr>
   </thead>
 </table>
 <div id="tb">
 	<div style="margin-top:10px">
 		&nbsp;时间：&nbsp;<input type="text" id="i1" size="20" class="easyui-datetimebox" style="width:150px" />
 		&nbsp;至&nbsp;
		<input type="text" id="i2" size="20" class="easyui-datetimebox"  style="width:150px" />
		
 		<a href="javascript:searchSysOperationRecord()" class="easyui-linkbutton" iconCls="icon-search" plain="true"><b style="font-size:15px">搜索</b></a>
 	</div>
 </div>
</body>
</html>